package com.haircut.project.utils.excel;

import com.alibaba.excel.write.metadata.style.WriteCellStyle;
import com.alibaba.excel.write.metadata.style.WriteFont;
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.VerticalAlignment;

public class ExceUtils {

    public static HorizontalCellStyleStrategy getHorizontalCellStyleStrategy(){
        WriteCellStyle cellStyle = new WriteCellStyle();
        cellStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex());
        WriteFont headerFont = new WriteFont();
        headerFont.setFontHeightInPoints((short)13);
        headerFont.setBold(Boolean.TRUE);
        cellStyle.setWriteFont(headerFont);
        cellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);

        WriteCellStyle centCellstyle = new WriteCellStyle();
        centCellstyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
        centCellstyle.setVerticalAlignment(VerticalAlignment.CENTER);
        centCellstyle.setWrapped(Boolean.TRUE);
        return new HorizontalCellStyleStrategy(cellStyle,centCellstyle);
    }
}
